package com.mini.mysql.service;

import com.mini.mysql.model.LessonAdInfo;
import com.mini.mysql.repository.LessonAdInfoRepository;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 项目名称：mini-data-es
 * 类 名 称：LessonAdInfoService
 * 类 描 述：TODO
 * 创建时间：2021/4/1 下午5:46
 * 创 建 人：zhanghuiying
 */
@Service
@Slf4j
public class LessonAdInfoService {

    @Autowired
    private LessonAdInfoRepository lessonAdInfoRepository;
    /**
     * 查询小课广告计划map
     * @return
     */
    public Map<String,String> getLessonAdInfoMap(){
        Map<String,String> remap = new HashMap();

        List<LessonAdInfo> relist = lessonAdInfoRepository.findAll();
        for(LessonAdInfo lessonAdInfo : relist){
            remap.put(lessonAdInfo.getMiniLessonId()+"",lessonAdInfo.getCampaignName());
        }
        return remap;
    }
}
